/**
 * @param {number[]} count
 * @return {number[]}
 */
var sampleStats = function (count) {
  let arr = [], min = -1, max = 256, sum = 0, mean = 0, median,more=0,moreIndex

  for (let i = 0; i < count.length; i++) {
    if (count[i]) {
      if(count[i]>more){
        more = count[i]
        moreIndex=i
      }
      arr.concat(new Array(count[i]).fill(i))
      sum += i * count[i]
    }
  }
  min = arr[0]
  max = arr[arr.length - 1]
  mean = sum / arr.length
  if (arr.length % 2 == 0) {
    median = (arr[arr.length / 2 - 1] + arr[arr.length / 2]) / 2
  }

  return [min,max,mean,median,moreIndex]

};